package io;

import graphics.datastructures.Model;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class ObjectFileReader implements ModelReader {
	private ObjectInputStream _file;
	public ObjectFileReader(String file) throws FileNotFoundException, IOException
	{
		_file = new ObjectInputStream(new FileInputStream(new File(file)));
	}
	@Override
	public Model read() {

			Model o;
			try {
				o = (Model) _file.readObject();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new Error(e);
			}
	
		return o;
	}

}
